package cn.kgc.tangcco.rest;

import cn.kgc.tangcco.model.ResposeText;
import cn.kgc.tangcco.model.ResultCode;
import cn.kgc.tangcco.pojo.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/10/9 10:01
 */
@Path(value = "/user")
@Produces(value = MediaType.APPLICATION_JSON)
public class UserTest {
    @POST
    @Path(value = "/login")
    @Consumes(value = MediaType.APPLICATION_JSON)
    public ResposeText login(User user, @Context HttpServletRequest request){
        System.out.println(request.getSession().getId());
        user.setNickname("李昊哲");
        return new ResposeText(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(), user);
    }
}
